package esi.t2no1.dao.contract;

import java.util.Date;

import esi.t2no1.ws.model.Address;
import esi.t2no1.ws.model.ContractOutput;
import esi.t2no1.ws.model.CreateContractInput;
import esi.t2no1.ws.model.User;

/**
 * @author Kaarel Jõgeva
 */
public class ContractDTO {

	private Long id;
	private String newSupplierId;
    private String oldSupplierId;
    private String balanceProviderId;
    private String networkOwnerId;
    private String clientContractNumber;
    private String facilityId;
    private String areaId;
    private String settlement;
    private Date startDate;
    private Date endDate;
    private String userName;
    private Date userBirthDate;
    private String userAddressHouse;
    private String userAddressStreet;
    private String userAddressCity;
    private String userAddressCountry;

    public ContractDTO() {
        // Default constructor
    }

    public ContractDTO(CreateContractInput input) {
        newSupplierId = input.getNewSupplierId();
        oldSupplierId = input.getOldSupplierId();
        balanceProviderId = input.getBalanceProviderId();
        networkOwnerId = input.getNetworkOwnerId();
        clientContractNumber = input.getClientContractNumber();
        facilityId = input.getFacilityId();
        areaId = input.getAreaId();
        settlement = input.getSettlement();
        startDate = input.getStartDate();
        userName = input.getUser().getName();
        userBirthDate = input.getUser().getBirthDate();
        userAddressHouse = input.getUser().getAddress().getHouse();
        userAddressStreet = input.getUser().getAddress().getStreet();
        userAddressCity = input.getUser().getAddress().getCity();
        userAddressCountry = input.getUser().getAddress().getCountry();
    }

    public ContractOutput toContractOutput() {
        ContractOutput o = new ContractOutput();
        o.setNewSupplierId(newSupplierId);
        o.setOldSupplierId(oldSupplierId);
        o.setBalanceProviderId(balanceProviderId);
        o.setNetworkOwnerId(networkOwnerId);
        o.setClientContractNumber(clientContractNumber);
        o.setFacilityId(facilityId);
        o.setAreaId(areaId);
        o.setSettlement(settlement);
        o.setStartDate(startDate);
        o.setEndDate(endDate);
        User u = new User();
        u.setName(userName);
        u.setBirthDate(userBirthDate);
        Address a = new Address();
        a.setHouse(userAddressHouse);
        a.setStreet(userAddressStreet);
        a.setCity(userAddressCity);
        a.setCountry(userAddressCountry);
        u.setAddress(a);

        return o;
    }

    public String getNewSupplierId() {
        return newSupplierId;
    }

    public void setNewSupplierId(String newSupplierId) {
        this.newSupplierId = newSupplierId;
    }

    public String getOldSupplierId() {
        return oldSupplierId;
    }

    public void setOldSupplierId(String oldSupplierId) {
        this.oldSupplierId = oldSupplierId;
    }

    public String getBalanceProviderId() {
        return balanceProviderId;
    }

    public void setBalanceProviderId(String balanceProviderId) {
        this.balanceProviderId = balanceProviderId;
    }

    public String getNetworkOwnerId() {
        return networkOwnerId;
    }

    public void setNetworkOwnerId(String networkOwnerId) {
        this.networkOwnerId = networkOwnerId;
    }

    public String getClientContractNumber() {
        return clientContractNumber;
    }

    public void setClientContractNumber(String clientContractNumber) {
        this.clientContractNumber = clientContractNumber;
    }

    public String getFacilityId() {
        return facilityId;
    }

    public void setFacilityId(String facilityId) {
        this.facilityId = facilityId;
    }

    public String getAreaId() {
        return areaId;
    }

    public void setAreaId(String areaId) {
        this.areaId = areaId;
    }

    public String getSettlement() {
        return settlement;
    }

    public void setSettlement(String settlement) {
        this.settlement = settlement;
    }

    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public Date getUserBirthDate() {
        return userBirthDate;
    }

    public void setUserBirthDate(Date userBirthDate) {
        this.userBirthDate = userBirthDate;
    }

    public String getUserAddressHouse() {
        return userAddressHouse;
    }

    public void setUserAddressHouse(String userAddressHouse) {
        this.userAddressHouse = userAddressHouse;
    }

    public String getUserAddressStreet() {
        return userAddressStreet;
    }

    public void setUserAddressStreet(String userAddressStreet) {
        this.userAddressStreet = userAddressStreet;
    }

    public String getUserAddressCity() {
        return userAddressCity;
    }

    public void setUserAddressCity(String userAddressCity) {
        this.userAddressCity = userAddressCity;
    }

    public String getUserAddressCountry() {
        return userAddressCountry;
    }

    public void setUserAddressCountry(String userAddressCountry) {
        this.userAddressCountry = userAddressCountry;
    }

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

}
